﻿<%@ Page Title="Sub Products" Language="C#" MasterPageFile="~/TableMaster.master" AutoEventWireup="true" CodeFile="SubProducts.aspx.cs" Inherits="admin_SubProducts" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        @media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px) {

            .resTbl tr:nth-of-type(odd) {
                background-color: #CDE2FF;
            }

            .resTbl tr:nth-of-type(1) {
                display: none;
            }

            .resTbl td:nth-of-type(1):before {
                content: "Product Name";
            }

            .resTbl td:nth-of-type(2):before {
                content: "Purity Name";
            }

            .resTbl td:nth-of-type(3):before {
                content: "Psd Name";
            }

            .resTbl td:nth-of-type(4):before {
                content: "Surface Area Name";
            }

            .resTbl td:nth-of-type(5):before {
                content: "Mill Type Name";
            }

            .resTbl td:nth-of-type(6):before {
                content: "Stock In Kg";
            }

            .resTbl td:nth-of-type(7):before {
                content: "Is Outsource";
            }

            .resTbl td:nth-of-type(8):before {
                content: "Outsource Details";
            }

            .resTbl td:nth-of-type(9):before {
                content: "Is Active";
            }

            .resTbl td:nth-of-type(10):before {
                content: "Created By";
            }

            .resTbl td:nth-of-type(11):before {
                content: "Created Date";
            }
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Add" runat="Server">


    <asp:Panel ID="pnlAdd" runat="server">

        <table cellpadding="0" cellspacing="0" style="width: 100%;">

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblPRODUCT_ID" runat="server" AssociatedControlID="ddlPRODUCT_ID" Text="Product Id:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlPRODUCT_ID" runat="server" AppendDataBoundItems="True" DataSourceID="DS_Products" DataTextField="PRODUCT_NAME" DataValueField="PRODUCT_ID" EnableViewState="false">
                        <asp:ListItem Value="0" Text="--Select--" />
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_Products" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_product_master"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblPURITY_ID" runat="server" AssociatedControlID="ddlPURITY_ID" Text="Purity Id:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlPURITY_ID" runat="server" AppendDataBoundItems="True" DataSourceID="DS_Purities" DataTextField="PURITY_TYPE" DataValueField="PURITY_ID" EnableViewState="false">
                        <asp:ListItem Value="0" Text="--Select--" />
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_Purities" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_purity"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblPSD_ID" runat="server" AssociatedControlID="ddlPSD_ID" Text="Psd Id:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlPSD_ID" runat="server" AppendDataBoundItems="True" DataSourceID="DS_PSD" DataTextField="PSD_TYPE" DataValueField="PSD_ID" EnableViewState="false">
                        <asp:ListItem Value="0" Text="--Select--" />
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_PSD" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_psd_type"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblSURFACE_AREA_ID" runat="server" AssociatedControlID="ddlSURFACE_AREA_ID" Text="Surface Area Id:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlSURFACE_AREA_ID" runat="server" AppendDataBoundItems="True" DataSourceID="DS_SurfaceArea" DataTextField="SURFACE_AREA_TYPE" DataValueField="SURFACE_AREA_ID" EnableViewState="false">
                        <asp:ListItem Value="0" Text="--Select--" />
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_SurfaceArea" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_surface_area"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblMILL_TYPE_ID" runat="server" AssociatedControlID="ddlMILL_TYPE_ID" Text="Mill Type Id:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlMILL_TYPE_ID" runat="server" AppendDataBoundItems="True" DataSourceID="DS_MillTypes" DataTextField="MILL_TYPE" DataValueField="MILL_ID" EnableViewState="false">
                        <asp:ListItem Value="0" Text="--Select--" />
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_MillTypes" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_mills_master"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblSTOCK_IN_KG" runat="server" AssociatedControlID="txtSTOCK_IN_KG" Text="Stock In Kg:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtSTOCK_IN_KG" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblIS_OUTSOURCE" runat="server" AssociatedControlID="chkIS_OUTSOURCE" Text="Is Outsource:"></asp:Label>
                </td>
                <td>
                    <asp:CheckBox ID="chkIS_OUTSOURCE" runat="server"></asp:CheckBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblOUTSOURCE_DETAILS" runat="server" AssociatedControlID="txtOUTSOURCE_DETAILS" Text="Outsource Details:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtOUTSOURCE_DETAILS" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblIS_ACTIVE" runat="server" AssociatedControlID="chkIS_ACTIVE" Text="Is Active:"></asp:Label>
                </td>
                <td>
                    <asp:CheckBox ID="chkIS_ACTIVE" runat="server"></asp:CheckBox>
                </td>
            </tr>


            <tr>
                <td style="width: 170px">&nbsp;</td>
                <td>

                    <asp:Button ID="btnSave" runat="server" CssClass="btn btn-success" OnClick="btnSave_Click" Text="Save" Width="90px" />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnCancel" runat="server" CssClass="btn btn-danger" OnClick="btnCancel_Click" Text="Cancel" Width="90px" />

                </td>
            </tr>

        </table>

    </asp:Panel>

</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Grid" runat="Server">
    <asp:Panel ID="pnlList" runat="server">
        <asp:GridView ID="gridClients" runat="server" AutoGenerateColumns="False" CssClass="resTbl" DataSourceID="DS_tbl_sub_products">
            <Columns>
                <asp:BoundField DataField="PRODUCT_ID" HeaderText="Product Name" SortExpression="PRODUCT_ID" />
                <asp:BoundField DataField="PURITY_ID" HeaderText="Purity Name" SortExpression="PURITY_ID" />
                <asp:BoundField DataField="PSD_ID" HeaderText="Psd Name" SortExpression="PSD_ID" />
                <asp:BoundField DataField="SURFACE_AREA_ID" HeaderText="Surface Area Name" SortExpression="SURFACE_AREA_ID" />
                <asp:BoundField DataField="MILL_TYPE_ID" HeaderText="Mill Type Name" SortExpression="MILL_TYPE_ID" />
                <asp:BoundField DataField="STOCK_IN_KG" HeaderText="Stock In Kg" SortExpression="STOCK_IN_KG" />
                <asp:BoundField DataField="IS_OUTSOURCE" HeaderText="Is Outsource" SortExpression="IS_OUTSOURCE" />
                <asp:BoundField DataField="OUTSOURCE_DETAILS" HeaderText="Outsource Details" SortExpression="OUTSOURCE_DETAILS" />
                <asp:BoundField DataField="IS_ACTIVE" HeaderText="Is Active" SortExpression="IS_ACTIVE" />
                <asp:BoundField DataField="CREATED_BY" HeaderText="Created By" SortExpression="CREATED_BY" />
                <asp:BoundField DataField="CREATED_DATE" HeaderText="Created Date" SortExpression="CREATED_DATE" DataFormatString="{0:yyMMdd}" />

                <asp:TemplateField HeaderText="Edit">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkEdit" runat="server" Text="Edit" CommandArgument='<%# Eval("SUB_PRODUCT_ID") %>' OnClick="linkEdit_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Delete">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkDelete" CommandName="delete" runat="server" Text="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this record?');" CommandArgument='<%# Eval("SUB_PRODUCT_ID") %>' OnClick="linkDelete_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="DS_tbl_sub_products" runat="server" SelectMethod="selectAllForGrid" DeleteMethod="delete" InsertMethod="insert" UpdateMethod="update" TypeName="DAL_tbl_sub_products">
            <DeleteParameters>
                <asp:Parameter Name="SUB_PRODUCT_ID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="PRODUCT_ID" Type="Int32" />
                <asp:Parameter Name="PURITY_ID" Type="Int32" />
                <asp:Parameter Name="PSD_ID" Type="Int32" />
                <asp:Parameter Name="SURFACE_AREA_ID" Type="Int32" />
                <asp:Parameter Name="MILL_TYPE_ID" Type="Int32" />
                <asp:Parameter Name="STOCK_IN_KG" Type="Int32" />
                <asp:Parameter Name="IS_OUTSOURCE" Type="Int32" />
                <asp:Parameter Name="OUTSOURCE_DETAILS" Type="String" />
                <asp:Parameter Name="IS_ACTIVE" Type="Int32" />
                <asp:Parameter Name="CREATED_BY" Type="String" />
                <asp:Parameter Name="CREATED_DATE" Type="DateTime" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="PRODUCT_ID" Type="Int32" />
                <asp:Parameter Name="PURITY_ID" Type="Int32" />
                <asp:Parameter Name="PSD_ID" Type="Int32" />
                <asp:Parameter Name="SURFACE_AREA_ID" Type="Int32" />
                <asp:Parameter Name="MILL_TYPE_ID" Type="Int32" />
                <asp:Parameter Name="STOCK_IN_KG" Type="Int32" />
                <asp:Parameter Name="IS_OUTSOURCE" Type="Int32" />
                <asp:Parameter Name="OUTSOURCE_DETAILS" Type="String" />
                <asp:Parameter Name="IS_ACTIVE" Type="Int32" />
                <asp:Parameter Name="MODIFIED_BY" Type="String" />
                <asp:Parameter Name="MODIFIED_DATE" Type="DateTime" />
            </UpdateParameters>
        </asp:ObjectDataSource>
    </asp:Panel>
</asp:Content>

